package edu.terapia.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the identity_object_relationship_type database table.
 * 
 */
@Entity
@Table(name="identity_object_relationship_type")
public class IdentityObjectRelationshipType implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int id;

	private String name;

	//bi-directional many-to-one association to IdentityObjectRelationship
	@OneToMany(mappedBy="identityObjectRelationshipType")
	private List<IdentityObjectRelationship> identityObjectRelationships;

	//bi-directional many-to-one association to IdentityPermission
	@OneToMany(mappedBy="identityObjectRelationshipType")
	private List<IdentityPermission> identityPermissions;

	public IdentityObjectRelationshipType() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<IdentityObjectRelationship> getIdentityObjectRelationships() {
		return this.identityObjectRelationships;
	}

	public void setIdentityObjectRelationships(List<IdentityObjectRelationship> identityObjectRelationships) {
		this.identityObjectRelationships = identityObjectRelationships;
	}

	public IdentityObjectRelationship addIdentityObjectRelationship(IdentityObjectRelationship identityObjectRelationship) {
		getIdentityObjectRelationships().add(identityObjectRelationship);
		identityObjectRelationship.setIdentityObjectRelationshipType(this);

		return identityObjectRelationship;
	}

	public IdentityObjectRelationship removeIdentityObjectRelationship(IdentityObjectRelationship identityObjectRelationship) {
		getIdentityObjectRelationships().remove(identityObjectRelationship);
		identityObjectRelationship.setIdentityObjectRelationshipType(null);

		return identityObjectRelationship;
	}

	public List<IdentityPermission> getIdentityPermissions() {
		return this.identityPermissions;
	}

	public void setIdentityPermissions(List<IdentityPermission> identityPermissions) {
		this.identityPermissions = identityPermissions;
	}

	public IdentityPermission addIdentityPermission(IdentityPermission identityPermission) {
		getIdentityPermissions().add(identityPermission);
		identityPermission.setIdentityObjectRelationshipType(this);

		return identityPermission;
	}

	public IdentityPermission removeIdentityPermission(IdentityPermission identityPermission) {
		getIdentityPermissions().remove(identityPermission);
		identityPermission.setIdentityObjectRelationshipType(null);

		return identityPermission;
	}

}